Skip to content

Pin backend dependencies using pip-compile#11

Merged
ambv merged 6 commits intomainfrom
backend-pin-deps
Mar 16, 2026
Merged

Pin backend dependencies using pip-compile#11
ambv merged 6 commits intomainfrom
backend-pin-deps

Conversation

@ambv
Copy link
Contributor

@ambv ambv commented Mar 16, 2026

Any merged PR triggers deploy events for both frontend and backend, and currently the backend requirements.txt is outdated with insufficient pinning, leading to a failed deploy.

This PR fixes that by employing pip-compile to pin production deps and allow updating the pins painlessly.

There's some semi-related documentation churn here, too, standardizing development on "docker compose". There wasn't a great place to put those changes in separately, so let's just be done with it now.

ambv and others added 4 commits March 16, 2026 14:24
Split requirements into requirements.in (direct dependencies with
loose constraints) and requirements.txt (fully pinned lockfile with
hashes, generated by pip-compile). This makes Docker builds
deterministic and prevents unrelated PRs from pulling in breaking
dependency updates.

To update dependencies:
  docker run --rm -v "$(pwd)/backend:/app" -w /app python:3.13-slim-bookworm \
    sh -c "pip install --quiet pip-tools && pip-compile --strip-extras \
    --generate-hashes --output-file requirements.txt requirements.in"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The production Dockerfile already uses python:3.13-slim-bookworm.
Dev was on python:3.11-slim, which could mask compatibility issues.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Prevents merging PRs where someone edits requirements.in but forgets
to regenerate the lockfile with pip-compile.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Pins backend Python dependencies using pip-compile to prevent deploy breakages from drifting/unpinned packages, and adds documentation + CI guardrails to keep the lockfile updated.

Changes:

  • Introduce backend/requirements.in and regenerate backend/requirements.txt as a fully pinned, hashed lockfile.
  • Update docs with a repeatable pip-compile workflow for updating backend dependency pins.
  • Replace the dummy CI workflow with a PR check that enforces updating requirements.txt when requirements.in changes.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
docker-README.md Documents how to regenerate backend dependency pins with pip-tools.
backend/requirements.txt Replaces the old loosely-pinned requirements with a pip-compiled, hashed lockfile.
backend/requirements.in Adds the source-of-truth direct dependency list for pip-compile.
backend/Dockerfile.dev Updates the dev image base to Python 3.13 bookworm to match the lockfile generation context.
README.md Updates prerequisites and documents the backend lockfile update process.
.github/workflows/ci.yml Adds a PR-time check to ensure lockfile changes accompany input dependency changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

ambv and others added 2 commits March 16, 2026 15:00
Move pytest and pytest-asyncio to a separate requirements-dev.in so
they don't ship in the production image. Add psycopg2-binary to
requirements.in and remove the separate pip install from the prod
Dockerfile. Update README Quick Start to use Docker commands instead
of make targets. Update CI to check both lockfiles. Regenerate both
lockfiles.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move Makefile targets into a separate "Local Development (not
recommended)" section. Standardize on "docker compose" (space) in all
documentation. Add Docker command for populating mock data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ambv ambv merged commit 663a0da into main Mar 16, 2026
1 check passed
@ambv ambv deleted the backend-pin-deps branch March 16, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants